<template>
    <div>
        <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="item in newslist" :key="item.img" @click="item.clickTime++">
					<router-link :to="'/home/newsinfo/' + item.id ">
						<img class="mui-media-object mui-pull-left" :src="item.img">
						<div class="mui-media-body">
							<h1>{{item.title}}</h1>
                            <p class="mui-ellipsis">
                                <span>发表时间：{{item.time | dataFormat}}</span>
                                <span>点击:{{item.clickTime}}次</span>
                            </p>
						</div>
					</router-link>
				</li>
			</ul>
    </div>
</template>

<script>

export default {
    data(){
        return {
            newslist:[
                { id:1, title:'新闻标题', time:"2019-06-27 23:27", img:"../imgs/1.png" , clickTime: 1},
                { id:2, title:'新闻标题', time:"2019-06-27 23:27", img:"../imgs/2.png" , clickTime: 1}
            ] 
        };
    },
    methods:{
        //通过ajax请求获取服务器新闻数据 （服务器端暂未实现）
        getNewsList(){
            this.$http.get('#').then(result=>{
                this.newslist = result.body.message;
            })
        }
    }
}
</script>


<style lang="scss">
li{
    div{
        h1{
            font-size: 14px
        }
        .mui-ellipsis{
            font-size: 12px;
            color: royalblue;
            display: flex;
            justify-content: space-between;
        }
    }
}
</style>
